package dataStruct.queue;

import java.net.Socket;
import java.util.concurrent.DelayQueue;

public class DelayedTest {
    public static void main(String[] args) throws InterruptedException {
        DelayQueue<DelayedTask> queue = new DelayQueue<>();

        queue.put(new DelayedTask(30000, "task1"));
        queue.put(new DelayedTask(20000, "task2"));

        while (!queue.isEmpty()) {
            DelayedTask task = queue.take();
            System.out.println(task.getTaskName());
        }
    }
}

